<include file="public@header"/>
</head>
<body>
	<div class="wrap ">
		<ul class="nav nav-tabs">
			<li><a href="{:url('Orders/index')}">订单管理</a></li>
			<li class="active"><a href="">创建订单</a></li>
		</ul>
		<form class="form-horizontal js-ajax-form" action="{:url('Orders/add_post')}" method="post">
			<fieldset>
                <div class="control-group">
					<label class="control-label">客户名称</label>
					<div class="controls">
						<input type="text" name="customer_name" value="" class="form-control" required/><span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">联系电话</label>
                    <div class="controls">
						<input type="text" name="customer_phone" value="" class="form-control" required/><span class="form-required">*</span>
                    </div>
				</div>
				<div class="control-group">
					<label class="control-label">墓位编号</label>
                    <div class="controls">
						<input type="hidden" name="tomb_id" value="" class="form-control"/>
						<input type="text" name="tomb_num" id="tomb_num" value="" class="form-control" required/><span class="form-required">&nbsp;
						<a href="javascript:;" id="getTombInfo" onclick="getTombInfo()">获取墓位信息</a></span>
                    </div>
				</div>
                <div class="control-group">
					<label class="control-label">具体位置</label>
					<div class="controls">
						<input type="text" name="tomb_address" value="" id="tomb_address" class="form-control" readonly style="width: 350px"/>
						<span class="form-required">*</span>
					</div>
				</div>
                <div class="control-group">
					<label class="control-label">销售价格</label>
					<div class="controls">
						<input type="text" name="sell_price" value="" id="sell_price" class="form-control" readonly/>
						<span class="form-required">*</span>
					</div>
				</div>
                <div class="control-group">
					<label class="control-label">选位时间</label>
					<div class="controls">
						<input type="text" class='js-date form-control' autocomplete="off" name="sell_time" value="" required><span class="form-required">*</span>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label">保留截止时间</label>
					<div class="controls">
						<input type="text" class='js-date form-control'autocomplete="off" name="end_time" value="" required><span class="form-required">*</span>
					</div>
				</div>
                <div class="control-group">
					<label class="control-label">导购员</label>
					<div class="controls">
						<select name="add_user"  class="form-control">
							<foreach name="userlist" item="vo1">
								<option value="{$vo1.id}">{$vo1.user_nickname}</option>
							</foreach>
						</select><span class="form-required">*</span>
					</div>
				</div>
				<input type="hidden" name="add_time">
				<input type="hidden" name="edit_user">
				<input type="hidden" name="order_sn">
				<input type="hidden" name="tomb_id" id="tomb_id">
				<input type="hidden" name="order_status">
			</fieldset>
			<div class="form-actions">
				<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
				<a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
			</div>
		</form>
	</div>
	<script type="text/javascript" src="__STATIC__/js/admin.js?v={:time()}"></script>

	<script type="text/javascript">
		function getTombInfo(){
			var tomb_num = $("#tomb_num").val();

			if(tomb_num == null || tomb_num == ''){
                layer.msg("请先输入墓位编号");
				return;
			}

			$.ajax({
				url		: "{:url('orders/getTombInfo')}",
				type	: "post",
				dataType: "json",
				data	: {'tomb_num':tomb_num, 'Ajax': 1},
				success : function(result){
					if(result != null){
						$("#tomb_id").val(result['tomb_id']);
						$("#sell_price").val(result['selling_price']);
						$("#tomb_address").val(result['tomb_region']);
					}else{
						$("#tomb_id").val('');
						$("#sell_price").val('');
						$("#tomb_address").val('');
                        layer.msg("该墓位编号对应信息不存在，请重新输入正确的墓位编号");
					}
				},
				error	: function(){
                    layer.msg("服务器内部错误，请联系系统管理员");
				}
			});
		}
	</script>
</body>
</html>




